export const generatedColumns = vm => {
  return [
    {
      title: "地域",
      key: "name",
      align: "center"
    },
    {
      title: "所属省份",
      align: "center",
      key: "belong"
    },
    {
      title: "操作",
      align: "center",
      width: 190,
      render: (h, params) => {
        const row = JSON.parse(JSON.stringify(params.row))
        return h("div", [
          h(
            "Poptip",
            {
              props: {
                confirm: true,
                title: "您确定要删除这条数据吗?",
                transfer: true,
                cancelText: "取消"
              },
              on: {
                "on-ok": () => vm.handleDelete(row)
              }
            },
            [
              h(
                "Button",
                {
                  style: {
                    marginRight: "5px"
                  },
                  props: {
                    type: "error",
                    size: "small"
                  }
                },
                "删除"
              )
            ]
          )
        ])
      }
    }
  ]
}

export const generatedRules = () => {
  return {
    region: [
      {
        type: "number",
        required: true,
        trigger: "change",
        message: "请选择地域级别"
      }
    ],
    provinceId: [
      {
        required: true,
        message: "请选择省市区",
        trigger: "change"
      }
    ],
    name: [
      {
        required: true,
        message: "请输入地域名称",
        trigger: "change"
      }
    ]
  }
}

export const regionLevel = [
  // {
  //   level: 1,
  //   name: "直辖市"
  // },
  {
    level: 2,
    name: "一级地域"
  },
  {
    level: 3,
    name: "二级地域"
  }
]
